package tests;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.testng.annotations.Test;
import org.testng.annotations.AfterMethod;
import static org.junit.Assert.*;

import model.Film;


public class AddMovieNew extends tests.supers.TestBase{

	@AfterMethod
	public void checkLogin(){

		if(app.getUserHelper().isLoggedIn())
			app.getUserHelper().logout();
	}

	@Test
	public void addNewMovieOK(){

		Film movieOK = Film.generateNewFilm();

		app.getUserHelper().loginAs(ADMIN);

		app.getFilmHelper().create(movieOK);

		assertTrue(app.getFilmHelper().filmAddedSuccess());
	}

	@Test
	public void addNewMovieFailure(){

		Film movieWrong = Film.generateNewFilm().setTitle("");

		app.getUserHelper().loginAs(ADMIN);

		app.getFilmHelper().create(movieWrong);

		assertTrue(app.getFilmHelper().filmAddedFailure());

	}

}
